<!--
 * @Author: coman
 * @LastEditors: coman
 * @Date: 2020-06-18 19:00:23
 * @motto: No pain,No gain
 * @LastEditTime: 2020-06-18 20:03:44
--> 
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<!-- 反转字符串 -->
<body>
    <script>
         var str = 'abcdefg';
         function reverseStr(str){
            // 先将字符串变成数组
            str1 =str.split("");
           console.log(str1.reverse().join(""));
         }
         reverseStr(str);
         
         
    </script>
</body>
</html>